<?php

if(!$userLogin->isLogin() && $userLogin->getData()->rights != 1){
	header("Location:/login/");
	exit();
}

include dirname(__FILE__) . '/php/LeftMenu.php'; 


$content = "content";
$leftMenu = new LeftMenu();
$html = $URLC->getHtmlPage();

$leftMenu->setCurrent($html);

if($html != ''){
	
	$p = $leftMenu->getIncludePath($html);

	if(!is_array($p) || !isset($p['mod'])){
		header("Locatiom:/");
		exit();
	}
	
	include_once $_SERVER['DOCUMENT_ROOT'] . '/' . $p['mod'];
	
	$className = ucfirst($html) . "Backend";
	$class = new $className();
	
	if(!$class instanceof Backend){
		throw new Exception("Backend class must implement Backend class.");
	}
}



echo $out = strtr(file_get_contents(dirname(__FILE__) . "/tpl/backend.tpl"),
	array(
	'{CONTENT}' => (isset($class) && is_object($class))?$class->out():"",
	'{LEFT_MENU}' => $leftMenu->buildMenu()
		)
	);
exit();